package com.sky.city.dialog

import android.app.Activity
import android.app.Dialog
import android.content.Context
import android.os.Bundle
import android.view.Gravity
import android.view.ViewGroup
import com.sky.city.R

class LanguageDialog: Dialog {

    private val mActivity:Activity?=null

     constructor(context: Context, themeResId: Int) :super(context,themeResId){
         mActivity==context
    }
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        val view=layoutInflater.inflate(R.layout.dialog_language_layout,null)

        setContentView(view, ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT))
        val window = window
        // 设置显示动画
                window!!.setGravity(Gravity.BOTTOM); //可设置dialog的位置
        // 设置显示动画
        //        window.setGravity(Gravity.BOTTOM); //可设置dialog的位置
        window!!.setWindowAnimations(R.style.picker_view_slide_anim)
        val wl = window!!.attributes
//        wl.x = 0
//        wl.y = mActivity!!.getWindowManager().getDefaultDisplay().getHeight()
//        // 以下这两句是为了保证按钮可以水平满屏
//        // 以下这两句是为了保证按钮可以水平满屏
        wl.width = ViewGroup.LayoutParams.MATCH_PARENT
        wl.height = ViewGroup.LayoutParams.WRAP_CONTENT

        // 设置显示位置

        // 设置显示位置
        onWindowAttributesChanged(wl)
    }

}